<template>
  <ul :class="{ displayShow: displayShow, nav: true }">
    <li>
      <i class="el-icon-warning-outline"></i>
    </li>
    <li>
      <i class="el-icon-search"></i>
    </li>
    <li class="choose-car" @click="chooseCar">选择车辆</li>
    <li @click="moveTolocation">
      <i class="el-icon-location-outline"></i>
    </li>
    <li @click="goToUser">
      <i class="el-icon-user"></i>
    </li>
  </ul>
</template>

<script>

export default {
  name: "Nav",
  methods: {
    // 去用户中心
    goToUser() {
      this.$router.push({ 
        name: this.$store.state.userAbout.token ? "User" : "Login" 
      });
    },
    // 去选择车辆
    chooseCar() {
      localStorage.getItem('id') ? this.$router.push({ name: "Car" }) : this.$message({type: 'warning', message: '请先选择停车场'})
      
    },
    // 定位
    moveTolocation() {
      this.$bus.$emit("location");
    },
  },
  computed: {
    displayShow() {
      return this.$route.name === "Car" ? true : false;
    },
  },
};
</script>

<style lang="scss" scoped>
.nav {
  position: fixed;
  bottom: 86px;
  left: 50%;
  transform: translate(-50%);
  z-index: 1;
  height: 86px;
  line-height: 86px;
  color: #fff;
  li {
    width: 44px;
    height: 44px;
    line-height: 44px;
    text-align: center;
    background-color: #3c4147;
    border-radius: 50%;
    display: inline-block;
    margin-right: 34px;
    &:hover {
      cursor: pointer;
      color: #00a3ff;
    }
    i {
      line-height: 44px;
      font-size: 16px;
      &:hover {
        color: #00a3ff;
      }
    }
  }
  .choose-car {
    width: 240px;
    height: 100%;
    line-height: 86px;
    margin-right: 34px;
    font-size: 26px;
    border-radius: 40px;
  }
}
.displayShow {
  display: none;
}
</style>